package cn.edu.ctbu.labtest.service;

import cn.edu.ctbu.labtest.dao.StudentRepository;
import cn.edu.ctbu.labtest.domain.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {

    /**
     * 读取所有学生
     * @return
     */
     List<Student> findAll();
     /*
     * 只分页的查询
     * @param pageable
     * @return
     */
    Page<Student> findAll(Pageable pageable);



    /*
    *分页,带过滤的查询*@param
    @param pageable
    *@return
    */
    public Page<Student> findAll(Example<Student> student, Pageable pageable);






    /**
     *插入学生
     */
     Student insert(Student student);


    /**
     * 更新学生
     */
    Student update(Student student);


    void delete(Student student);

    void delete(Long id);

    Student getById(Long id);




    /**
     * 查找学生
     public Student search(Long id)
     {
     return studentRepository.findById(id).get();
     }
     public List<Student> findStudentByName(String name) { return studentRepository.findStudentByName(name);}
     */

}
